Repository navigation
feat: clearer messages when an api call is refused or held back - #9576
Merged
Merged
Conversation
- output_paths points to job.policy_error when a policy refused the call, and says when the output policy held the outputs back - a blocking api call prints why it ended (_print_call_result) - the api table has a Policies column - ApiResult shows the api's args and when set_policies cleared its state; print(result) shows the same text as repr - the job view shows code/params.json in a Parameters section Messages and displays only; no behaviour changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
atlaie
force-pushed
the
atlaie/policy-ux-messages
branch
from
November 13, 2026 13:14
0a5d306 to
f6b3ebf
Compare
job.stderr, job.stdout and the hint of a failed job's output_paths said "No stderr file found" or "Check stderr" to a reader who was never given the log. They now say it is not shared with them, and who can share it: share_job_results for a datasite job, request_stderr / request_stdout for an enclave job. A call that a policy refused points to job.policy_error, since the log may not exist. The datasite owner, who keeps every log, still sees "No stderr file found". Messages only; no behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 13, 2026
output_paths is a user-facing API that is also used for chaining, so it should not print much. The new branches also mixed low-level checks into it. Drop the test checks on what it prints.
Collaborator
|
Thanks for this! I reverted the changes to
The rest of the PR stays as it was, including |
test_api_policies_allow_block_and_show checked the api view, the call as a request, the output policy and the rate limit in one run, with the rate limit relying on the earlier call. Each is now its own test on a fresh api from the new _adder_api() helper, which test_held_back_outputs_point_to_the_policy also uses. Variables say what they hold (blocked_job, large_call).
Drop filler words from test names and give vague names a noun, e.g. test_print_shows_the_summary -> test_api_result_str_matches_repr and ok -> ok_result.
…ft into atlaie/policy-ux-messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Found while testing #9566 end to end in Colab. This PR only changes messages and displays; no behaviour changes.
SyftRDSClient._wait_for_call()previously printed only the job status. Now it callsclient.py: _print_call_result(), which also prints the refusal reason, or that the outputs were held back.job.stdoutorjob.stderrand has no copy of that log, we previously showed "No stdout file found". Now we say the log is not shared with them, and how it can be shared:share_job_resultsfor a normal job,request_stdoutorrequest_stderrfor an enclave job (EnclaveJobInfo._log_release_hint()). When a policy refused the call, we point tojob.policy_errorinstead. The DO still sees "No stdout file found".input, output,input,outputor-.set_policies, the returnedApiResultpreviously did not list the api's arguments or say whether the api's state was cleared. Now it lists the arguments, and says whenset_policiescleared the state (reset_state=True, the default).print(result)previously printed the raw pydantic fields; now it shows the same text asrepr(result).code/params.json, pretty-printed and HTML-escaped.Guidelines
High level
Mid level
ApiResult.argsandApiResult.state_clearedare returned to the caller, not storedjob_repr.py: _params_html()returns""when there is nocode/params.json, so the caller cannot see the conditionLow level
Security
No change to permissions. The new messages tell the DS that a log is not shared and how it can be shared; they do not share it. The Parameters section HTML-escapes
code/params.json, which the DS writes, so it cannot inject HTML into the DO's notebook.Testing
uv sync --all-packages,just test-unit-job(157 passed),just test-unit-rds(155 passed),uv run pytest tests/unit/syft_bg(174 passed) andpre-commit run --all-files(passes).packages/syft-rds/tests/test_api_policies.py: capsys checks for the output-policy and rate-limit refusals, a held-back outputs test, and a Policies column test.tests/unit/syft_bg/test_api_result.py: the args, the cleared state, andprint(result).packages/syft-job/tests/test_policies.py: the "not shared with you" log message, and the escaped Parameters section.packages/syft-enclave/tests/test_read_permissions.py: an enclave job's unshared log points torequest_stdout/request_stderr.tests/integration/syft_bg/test_cli.pygives 24 passed and 2 failed. The 2 remove-peer failures happen the same way on dev without this change (the test sets up an api withoutrun.sh), so I left them alone.Asana task